//
//  LHRecommendRestaurantViewController.m
//  Knight_Tour
//
//  Created by Bruce_Lin on 15/5/13.
//  Copyright (c) 2015年 TouchOne. All rights reserved.
//

#import "LHRecommendRestaurantViewController.h"
#import "LHRecommendRestaurantTableView.h"
#import "LHRecommendRestaurantDetailViewController.h"
#import "MyNavgationView.h"

@interface LHRecommendRestaurantViewController ()<jumpToResDetailDelegate>

@end

@implementation LHRecommendRestaurantViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor colorWithRed:0.871 green:0.962 blue:0.965 alpha:1.000];
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    self.title = @"餐馆列表";
    [self createRecommendResView];
    [self createNavigation];
    
}

// 创建自定义导航栏
- (void)createNavigation
{
    MyNavgationView *myNaView = [[MyNavgationView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
    
    [myNaView creatTitle:@""];
    
    myNaView.leftTarget = self;
    myNaView.leftAction = @selector(backToCityHomePageControllre);
    
    [myNaView creatLeftButtonWithImage:@"btn_nav_back"];
    
    
    
    [self.view addSubview:myNaView];
    
    [myNaView release];
    
}

- (void)backToCityHomePageControllre
{
    [self.navigationController popViewControllerAnimated:YES];
}


/**
 *  创建推荐餐馆视图
 */

- (void)createRecommendResView
{
    LHRecommendRestaurantTableView *recommendRes = [[LHRecommendRestaurantTableView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 34) cityId:self.cityId_res];
    
    [self.view addSubview:recommendRes];
    
    recommendRes.delegate = self;
    
    [recommendRes release];
    
}

// 实现跳转到餐馆详情页面方法
- (void)jumpToResDetailWithIndexPath:(NSIndexPath *)indexPath resArr:(NSMutableArray *)resArr
{
    LHRecommendRestaurantDetailViewController *resDetailVC = [[LHRecommendRestaurantDetailViewController alloc] autorelease];
    
    resDetailVC.recResMod = resArr[indexPath.row];
    
    [self.navigationController pushViewController:resDetailVC animated:YES];
    
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
